package com.woniuxy.carlife.carlifecommonsweb.util;

import java.util.Random;

/**
 * @author zjq
 * @ClassName:RandomCode
 * @Description:随机生成码
 * @date 2021/4/6 13:54
 **/

public class RandomCode {
    /**
     * 功能描述〈随机生成〉
     *
     * @throws
     * @author:zjq
     * @param: [count]
     * @return: java.lang.String
     * @Date 2021/4/6 14:02
     */

    public static String getCode(Integer count) {
        char[] bytes = "QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm0123456789".toCharArray();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < count; i++) {
            char a = bytes[new Random().nextInt(bytes.length)];
            sb.append(a);
        }
        return sb.toString();
    }
}
